package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Comment;
import cn.tedu._04mybatis.pojo.vo.CommentVo1;
import cn.tedu._04mybatis.pojo.vo.CommentVo2;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface CommentMapper {
    //@Insert("insert into comment(content,created,user_id,weibo_id) values(#{content},#{created},#{userId},#{weiboId})")
    int insertComment(Comment comment);

    //@Delete("delete from comment where id=#{id}")
    int deleteById(Long id);

    //@Update("update comment set content=#{content},created=#{created} where id=#{id}")
    int updateById(Comment comment);

    //@Select("select content,user_id userId,weibo_id weiboId from comment where id=#{id}")
    CommentVo1 selectById1(Long id);

    //@Select("select content,user_id userId from comment where id=#{id}")
    CommentVo2 selectById2(Long id);

    //动态修改
    int dynamicUpdate(Comment comment);
    //动态删除 数据方式
    int dynamicDelete(Integer[] ids);
    //动态删除 List集合方式
    int dynamicDelete2(ArrayList list);
    //统计评论的总数量
    int selectCount();
}
